angular.module("myKitchen")
.service("classifyService",function($http){
	this.getfirstItems = function(callback){
		$http.get("public/data/classData/class_second.json").success(callback);
	}
	this.getsecondItems = function(callback){
		$http.get("public/data/classData/class_third.json").success(callback);
	}

	this.getThirdItems = function(parentId,callback){
		// console.log(parentId);
		var url = "public/data/classData/class_menuList"+parentId+".json";
		$http.get(url).success(callback);
	}

	var arr=[];
	this.dataArr=function(name){
		arr=[name];
	}	
	this.getdataArr=function(){
		return arr;
	}
	
	//购物车
	var classifyCart = [];
	this.classifyCart = function(Item){
		var ItemIdx = classifyCart.indexOf(Item);
		if(ItemIdx==-1){

			classifyCart.push(Item);
		}else{
			classifyCart[ItemIdx] = Item;
		}
		
		// console.log(classifyCart);
	}	 	
	this.getClassifyItems = function(){
		return classifyCart;
	}				
})